<template>
  <div class="question-container">
    <header class="question-header">
      <slot name="header"></slot>
    </header>

    <main class="question-main">
      <slot name="main"></slot>
    </main>

    <footer v-if="showFooter" class="question-footer">
      <slot name="footer"></slot>
    </footer>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: 'QuestionContainer'
})

withDefaults(defineProps<{
  showFooter?: boolean
}>(), {
  showFooter: true
})
</script>

<style scoped>
.question-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.question-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #fff;
  height: 36px;
  line-height: 36px;
  padding: 0 16px;
  border-bottom: 1px solid #eee;
  align-items: center;
}

.question-main {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.question-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  background-color: #fff;
  height: 36px;
  line-height: 36px;
  padding: 0 3px 1px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
}
</style>
